 <%@page import="com.blockchain.common.enums.CertificateType"%>
<%@page import="com.blockchain.front.servlets.RegisterThree"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.common.enums.TermType"%>
<%@page import="com.blockchain.front.servlets.Term"%>
<%@page import="com.blockchain.front.servlets.Send"%>
<%@page import="com.blockchain.front.servlets.LoginVerify"%>
<%@page import="com.blockchain.front.servlets.CheckNameExists"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<html>
<head>
<%
String str = languageDefine.getValue(request, "register_verified");
String _TITLE_ = str+" - "+configureProvider.getProperty(SystemVariable.SITE_NAME);
String _DESCRIPTION_ = "综合数字货币交易平台，拥有专业的团队、先进的技术和资深的行业经验，致力于成为中国最稳定、最安全、最专业、最全面的数字货币、数字资产、虚拟货币综合交易平台。";
%>
<title><%=_TITLE_ %></title>
<%@include file="/WEB-INF/include/meta.jsp"%>
<meta name="description" content="<%=_DESCRIPTION_ %>">
<%@include file="/WEB-INF/include/style.jsp"%>
<%@include file="/WEB-INF/include/authenticatedSession.jsp"%>
</head>
<body>
<%@include file="/WEB-INF/include/header.jsp"%>
<div class="autobox" id="reg-step1">
    <div class="login_step">
        <ul class="order clear">
            <li class="orange step-end"><i class="order_1_1"></i><%=languageDefine.getValue(request, "register_userRegister")%>
                <div class="order_line"></div>
            </li>
            <li class="orange step-end"><i class="order_2_1"></i><%=languageDefine.getValue(request, "register_setTradePassword")%>
                <div class="order_line"></div>
            </li>
            <li class="orange"><i class="order_3_1"></i><%=languageDefine.getValue(request, "register_verified")%>
                <div class="order_line"></div>
            </li>
            <li><i class="order_4"></i><%=languageDefine.getValue(request, "register_success")%></li>
        </ul>
    </div>
    <%String errorMessage = controller.getPrompt(request,response,PromptLevel.ERROR);%>
    <form action="<%=controller.getURI(request, RegisterThree.class)%>" method="post" onsubmit="return onSubmit()">
     <div class="reg_box">
        <div class="reg_wrap pt47">
             <%if(!StringHelper.isEmpty(errorMessage)){%>
        	<div class="com_warning"><%StringHelper.filterHTML(out, null==errorMessage?"":(errorMessage.indexOf("err_")!=-1?languageDefine.getValue(request, errorMessage):errorMessage));%></div>
        	<%}else{%>
         	 <div class="reg_warning" style="position: relative;left:-60px;"><span><%=languageDefine.getValue(request, "register_countryRule")%></span></div>
         	<%}%>  
            <div class="reg_input_box reg-fb">
                <div class="reg_title"><%=languageDefine.getValue(request, "register_identifyType")%>：</div>
                <%-- <input type="radio" id="id_card" value="<%=backgroundDataFlag==1?CertificateType.SFZ.getName():backgroundDataFlag==2?CertificateType.SFZ.getNameEn():CertificateType.SFZ.getNameTw()%>" name="idType" checked="checked" --%>
                <input type="radio" id="id_card" value="<%=CertificateType.SFZ%>" name="idType" checked="checked"
                       style="width: 45px;margin-top: 11px;float: left;" ><span style="line-height: 40px;    float: left;"><%=languageDefine.getValue(request, "register_IDCard")%></span>
                <input type="radio" id="id_card" value="<%=CertificateType.HZ%>" name="idType" style="width: 45px;margin-top: 11px;float: left;">
                <span style="line-height: 40px;float:left;"><%=languageDefine.getValue(request, "register_hzCard")%></span>
                <input type="radio" id="other" value="<%=CertificateType.QTZJ%>" name="idType" style="width: 45px;margin-top: 11px;float: left;">
                <span style="line-height: 40px;"><%=languageDefine.getValue(request, "register_OtherCard")%></span>
            </div>
            <div class="reg_input_box reg-fb">
                <div class="reg_title"><%=languageDefine.getValue(request, "register_realName")%>：</div>
                <input type="text" id="regtruename" name="name"/>
                <div id="regtruename-msg" class="form_explain" style="display: none"
                     data-explain='<%=languageDefine.getValue(request, "register_realNameTip")%><em></em>'><%=languageDefine.getValue(request, "register_realNameTip")%><em></em></div>
            </div>
            <div class="reg_input_box reg-fb">
                <div class="reg_title"><%=languageDefine.getValue(request, "register_identifyNumber")%>：</div>
                <input type="text" id="regidcard"  name="zjh"/>
                <div id="regidcard-msg" class="form_explain" style="display: none"
                     data-explain='<%=languageDefine.getValue(request, "register_cannotMidifyIdCard")%><em></em>'><%=languageDefine.getValue(request, "register_cannotMidifyIdCard")%><em></em></div>
            </div>

            <div class="reg_button_box">
                <input type="submit" value='<%=languageDefine.getValue(request, "register_nextStep")%>' />
            </div>
        </div>
    </div>
    </form>
</div>
<%@include file="/WEB-INF/include/footer.jsp"%>
<%@include file="/WEB-INF/include/script.jsp"%>
<script type="text/javascript">
function onSubmit() {
	var truename = $("#regtruename").val();
		var idcard = $("#regidcard").val();
		if (truename == "" || truename == null) {
			layer.tips('<%=languageDefine.getValue(request, "js_enterRealName")%>', '#regtruename', {tips: 3});
			return false;
		}
		if (idcard == "" || idcard == null) {
			layer.tips('<%=languageDefine.getValue(request, "js_enterIDCardNumber")%>', '#regidcard', {tips: 3});
			return false;
		}
		//return isIdCardNo(idcard);
		return true;
	}
	function isIdCardNo(num) {  
	    num = num.toUpperCase();           //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X。        
	    if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {     
	        layer.tips('<%=languageDefine.getValue(request, "js_IDCardReg")%>', '#regidcard', {tips: 3});
	        return false;         
	    } //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
	    //下面分别分析出生日期和校验位 
	    var len, re; len = num.length; if (len == 15) { 
	        re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/); 
	        var arrSplit = num.match(re);  //检查生日日期是否正确
	        var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]); 
	        var bGoodDay; bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
	        if (!bGoodDay) {         
	            layer.tips('<%=languageDefine.getValue(request, "js_IDCardDateError")%>', '#regidcard', {tips: 3});
	            return false;
	        } else { //将15位身份证转成18位 //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。        
	            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);         
	            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');      
	            var nTemp = 0, i;            
	            num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);           
	            for(i = 0; i < 17; i ++) {                 
	                nTemp += num.substr(i, 1) * arrInt[i];        
	            }
	            num += arrCh[nTemp % 11]; 
	            return true;
	        }
	    }
	    if (len == 18) {
	        re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/); 
	        var arrSplit = num.match(re);  //检查生日日期是否正确 
	        var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]); 
	        var bGoodDay; bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4])); 
	        if (!bGoodDay) { 
	            layer.tips('<%=languageDefine.getValue(request, "js_IDCardDateError")%>', '#regidcard', {tips: 3});
	            return false; 
	        }
	        else { //检验18位身份证的校验码是否正确。 //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
	            var valnum; 
	            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); 
	            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); 
	            var nTemp = 0, i; 
	            for(i = 0; i < 17; i ++) { 
	                nTemp += num.substr(i, 1) * arrInt[i];
	            } 
	            valnum = arrCh[nTemp % 11]; 
	            if (valnum != num.substr(17, 1)) { 
	                layer.tips('<%=languageDefine.getValue(request, "js_IDCardError")%>', '#regidcard', {tips: 3});
	                return false; 
	            } 
	            return true; 
	        } 
	    } 
	    return false;
	}
</script>
</body>
</html>	
	
